-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace time.Time.String() with time.Time.Format() #1017
base: main
Are you sure you want to change the base?
Conversation
.github/workflows/draft-release.yaml
Outdated
@@ -6,6 +6,7 @@ on: | |||
- 'protocol/**' # Push events to matching protocol/foo/bar/v*, i.e. protocol/foo/bar/v1.0, protocol/foo/bar/v20.15.10 | |||
- 'observability/**' # Push events to matching observability/foo/bar/v* | |||
- 'sql/**' # Push events to matching sql/v* | |||
- 'binding/**' # Push events to matching binding/foo/bar/v* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should be separate PR
README.md
Outdated
@@ -27,7 +27,7 @@ _Note:_ Supported go version: 1.14+ | |||
Add the module as dependency using go mod: | |||
|
|||
```shell | |||
go get github.com/cloudevents/sdk-go/v2@v2.4.1 | |||
go get github.com/cloudevents/sdk-go/v2@v2.5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should be separate PR (incl. the other ones)
/* | ||
Copyright 2021 The CloudEvents Authors | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should be separate PR
stream.WriteString(eventContext.Time.String()) | ||
stream.WriteString(eventContext.Time.Format(time.RFC3339)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran an example w/ Go 1.22 (same w/ Go 1.21) here: https://go.dev/play/p/NcMTqPu75fe
And I get:
2009-11-10 23:00:00 +0000 UTC m=+0.000000001
2009-11-10T23:00:00Z
Which could be considered a breaking change. WDYT?
cc/ @duglin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with the breaking change. I'm more bothered that:
1 - it wasn't spec compliant before and no one noticed
2 - not a single testcase needed to be changed
I agree with splitting the upgrade stuff into a separate PR. But can we also get at least one testcase added that checks the format of the time
attribute and that it adheres to the CE spec (RFC3339) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll get to work on it! Thank you so much for the feedback!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaned up the PR. Currently working on test cases:)
a209c30
to
232dcc4
Compare
Signed-off-by: MaryamTaj <tajm48822@gmail.com>
Signed-off-by: MaryamTaj <tajm48822@gmail.com>
Signed-off-by: MaryamTaj <tajm48822@gmail.com>
@MaryamTaj converted to draft, seems you're still working on this. Once ready for review, please just mark as "Ready for review" and ping us. |
@MaryamTaj any update on this? |
@duglin Hi Doug! I was running into some issues earlier, where all the tests pass locally but not on GitHub. I am going to try a new approach, and I'll let you know how it goes |
ok thanks for the update. |
@MaryamTaj any update on this? |
Signed-off-by: MaryamTaj <tajm48822@gmail.com>
Signed-off-by: MaryamTaj <tajm48822@gmail.com>
@duglin I think I'm running into a wall. I tried to resolve as many errors as I could. |
Resolves #987
Earlier, we used time.Time.String() to marshal time into a string. According to the go time.Time documentation however, time.Time.String() is only suitable for debugging purposes. This PR replaces time.Time.String with time.Time.Format() with RFC3339 to provide a stable serialized representation of time.